package com.blog;

import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * 枚举类
 *
 * @author xiaoming
 * @date 2018/10/21
 */
public enum SeasonEnum {
    /**
     * 春天
     */
    SPRING(1),
    /**
     * 夏天
     */
    SUMMER(2),
    /**
     * 秋天
     */
    AUTUMN(3),
    /**
     * 冬天
     */
    WINTER(4);

    private int code;

    SeasonEnum(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String toString() {
        return Integer.toString(this.code);
    }

    public static void main(String[] args) {

        System.out.println(SeasonEnum.SPRING);

        // foreach
        for(SeasonEnum seasonEnum : SeasonEnum.values()){
               System.out.println(seasonEnum);
        }

        // Arrays.toString()
        System.out.println(Arrays.toString(SeasonEnum.values()));
    }
}
